package com.logistics.map.entity.model;

import com.logistics.utils.aspect.annotation.Dictionary;
import com.logistics.utils.tool.StringUtils;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class MapComponentCompare {

    private String clazz;
    private String color;
    private String uuid;
    private String label;
    private String size;
    private String type;
    private String locationArea;
    private String x;
    private String y;
    private String routeCode;
    private Integer containerId;
    private String agvType;
    private String remark;
    private String workshop;
    private String location;
    private String deviceId;
    private String locationWcCode;
    private String locationLock;
    private Integer currentStratum;
    private BigDecimal locationHeight;
    private String zone;
    private String relayWcCode;
    private String containerType;

    public static MapComponentCompare build(MapComponentsRow row){
        MapComponentCompare mapComponentCompare = new MapComponentCompare();
        mapComponentCompare.setClazz(row.getClazz());
        mapComponentCompare.setColor(row.getColor());
        mapComponentCompare.setUuid(row.getUuid());
        mapComponentCompare.setLabel(row.getLabel());
        mapComponentCompare.setSize(row.getSize());
        mapComponentCompare.setType(row.getType());
        mapComponentCompare.setLocation(row.getLocation());
        mapComponentCompare.setRouteCode(row.getRouteCode());
        mapComponentCompare.setContainerId(row.getContainerId());
        mapComponentCompare.setAgvType(row.getAgvType());
        mapComponentCompare.setRemark(row.getRemark());
        mapComponentCompare.setWorkshop(row.getWorkshop());
        mapComponentCompare.setLocationArea(row.getLocationArea());
        mapComponentCompare.setX(row.getX());
        mapComponentCompare.setY(row.getY());
        mapComponentCompare.setLocationWcCode(row.getLocationWcCode());
        mapComponentCompare.setLocationLock(row.getLocationLock());
        mapComponentCompare.setCurrentStratum(row.getCurrentStratum());
        mapComponentCompare.setLocationHeight(row.getLocationHeight());
        mapComponentCompare.setZone(row.getZone());
        mapComponentCompare.setRelayWcCode(row.getRelayWcCode());
        mapComponentCompare.setContainerType(row.getContainerType());
        return mapComponentCompare;
    }

    public static MapComponentCompare build(MapComponentsSave row){
        MapComponentCompare mapComponentCompare = new MapComponentCompare();
        mapComponentCompare.setClazz(row.getClazz());
        mapComponentCompare.setColor(row.getColor());
        mapComponentCompare.setUuid(row.getUuid());
        mapComponentCompare.setLabel(row.getLabel());
        mapComponentCompare.setSize(row.getSize());
        mapComponentCompare.setType(row.getType());
        mapComponentCompare.setLocation(row.getLocation());
        mapComponentCompare.setRouteCode(row.getRouteCode());
        mapComponentCompare.setContainerId(row.getContainerId());
        mapComponentCompare.setAgvType(row.getAgvType());
        mapComponentCompare.setRemark(row.getRemark());
        mapComponentCompare.setWorkshop(row.getWorkshop());
        mapComponentCompare.setLocationArea(row.getLocationArea());
        mapComponentCompare.setX(row.getX());
        mapComponentCompare.setY(row.getY());
        mapComponentCompare.setLocationWcCode(row.getLocationWcCode());
        mapComponentCompare.setLocationLock(row.getLocationLock() ? "1" : "0");
        mapComponentCompare.setCurrentStratum(row.getCurrentStratum());
        mapComponentCompare.setLocationHeight(StringUtils.isNotNull(row.getLocationHeight()) ?
                row.getLocationHeight().setScale(2, BigDecimal.ROUND_HALF_UP) : null);
        mapComponentCompare.setZone(row.getZone());
        mapComponentCompare.setRelayWcCode(row.getRelayWcCode());
        mapComponentCompare.setContainerType(row.getContainerType());
        return mapComponentCompare;
    }
}
